#ifndef PROVIDENT_YIELDCURVE_HPP_
#define PROVIDENT_YIELDCURVE_HPP_

#include <promote/ArrayList.hpp>

namespace provident
{
    class YieldCurve
    {
    public:
        enum Type {
            FLAT_YIELD, INTERPOLATED_YIELD, DISCRETIZED_YIELD
        };
        enum Term {
            OVERNIGHT = 0, ONE_WEEK, TWO_WEEK, THREE_WEEK,
            ONE_MONTH, TWO_MONTH, THREE_MONTH, FOUR_MONTH,
            FIVE_MONTH, SIX_MONTH, SEVEN_MONTH, EIGHT_MONTH,
            NINE_MONTH, TEN_MONTH, ELEVEN_MONTH, ONE_YEAR,
            TWO_YEAR, THREE_YEAR, FOUR_YEAR, FIVE_YEAR, TEN_YEAR
        };
        YieldCurve(Type const type);
        YieldCurve(const double flatYield);
        YieldCurve(const Term terms[], const double yields[]);
        YieldCurve(const double discretizedDates[], const double yields[]);
        YieldCurve(Type const type, const double discretizedDates[], const double yields[]);

        ~YieldCurve() { }

        void setYield(const double flatYield);
        void setYield(const Term term, const double yield);
        void setYield(const double discretizedDate, const double yield);

        double yieldForDate(const double yearsTilDate);
    private:
        const Type _type;
        double _flatYield;
        promote::ArrayList<double> _termYields;
        promote::ArrayList<double> _termYearsTilDate;
        

        const Term getNearestTermBefore(const double yearsTilDate);
        const Term getNearestTermAfter(const double yearsTilDate);
        const double getNearestYieldBefore(const double yearsTilDate);
        const double getNearestYieldAfter(const double yearsTilDate);
        
    };
}

#endif // PROVIDENT_YIELDCURVE_HPP_
